<template>
	<view>
		<!-- 顶部 -->
		<view class="background">
			<view class="icon" @click="index()">
				<van-icon name="arrow-left" size="22px" />
			</view>
			<view class="food">美食</view>
			<view class="search">
				<van-search :value=" value " shape="round" background="#fafafa" placeholder="请输入商家或商品名称" />
			</view>
		</view>
		<!-- 华莱士 -->
		<view class="wallace">
			<image :src="background" mode=""></image>
			<view class="wallace_price">满28减20 进店享更多优惠</view>
			<view class="shopping_list">
				<view class="shopping" v-for="(wallacr,index) in wallacr">
					<image :src="wallacr.img" mode=""></image>
					<view class="shoppine_name">{{wallacr.name}}</view>
					<view class="shoppine_price">￥{{wallacr.price}}</view>
				</view>
			</view>
		</view>
		<!-- tab -->
		<view class="tab">
			<view class="" v-for="(item,index) in tab">
				<image :src="item.img" mode=""></image>
				<view class="">{{item.name}}</view>
			</view>
		</view>
		<view class="merchant_tab">
			<view class="">综合排序</view>
			<view class="">销量高</view>
			<view class="">速度快</view>
			<view class="">新人立减</view>
			<view class="">筛选</view>
		</view>
		<!-- 商家列表 -->
		<view class="merchant" v-for="(item,index) in shopping" @click="shop(item.img,item.name,item.score,item.time,item.label,item.label_one,item.label_two,item.label_three)">
			<image :src="item.img" mode=""></image>
			<view class="shoppine_div">
				<view class="merchant_name">{{item.name}}</view>
				<view class="merchant_view">
					<view class="score">评分{{item.score}}</view>
					<view class="score">月售{{item.value}}</view>
					<view class="score">{{item.time}}分钟</view>
					<view class="score">{{item.distance}}km</view>
				</view>
				<view class="merchant_view">
					<view class="score">起送￥{{item.mum}}</view>
					<view class="score">免配送费</view>
					<view class="score">人均￥{{item.per}}</view>
					<view class="meituan">美团专送</view>
				</view>
				<view class="appraise">{{item.appraise}}</view>
				<view class="merchant_view">
					<view class="labels">{{item.label}}</view>
					<view class="labels">{{item.label_one}}</view>
					<view class="labels">{{item.label_two}}</view>
					<view class="labels">{{item.label_three}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import json from '../../json.js';
	export default {
		data() {
			return {
				wallacr: null,
				background: null,
				tab: null,
				shopping: null
			}
		},
		methods: {
			index() {
				uni.navigateBack({

				});
			},
			shop(img, name, score, time, label, label_one, label_two, label_three) {
				uni.navigateTo({
					url: "../shop/shop?img=" + img + "&name=" + name + "&score=" + score + "&time=" + time + "&label=" + label +
						"&label_one=" + label_one + "&label_two=" + label_two + "&label_three=" + label_three
				})
			}

		},
		onLoad() {
			this.wallacr = json.wallacr;
			this.background = json.background;
			this.tab = json.tab;
			this.shopping = json.shopping;
			console.log(this.shopping)
			console.log(this.wallacr)
			console.log(this.background)
			console.log(this.tab)
		}
	}
</script>

<style scoped>
	.food {
		font-size: 18px;
		font-weight: 900;
		text-align: center;
		margin-top: -28px;
	}

	.icon {
		padding-top: 30px;
		padding-left: 15px;
	}

	.background {
		background-color: #fafafa;
		width: 100%;
		height: 110px;
	}

	.search {
		width: 95%;
		margin-left: 2.5%;
		margin-top: 6px;
		position: absolute;
	}

	.wallace {
		background-color: #FFFFFF;
		width: 95%;
		margin-left: 2.5%;
		height: 260px;
		border-radius: 15px;
		overflow: hidden;
		margin-top: 15px;
		border: 0.5px solid #d5d4d9;
	}

	.wallace image {
		width: 100%;
		height: 80px;
	}

	.wallace_price {
		font-weight: 900;
		font-size: 20px;
		margin-bottom: 15px;
	}

	.shopping image {
		width: 110px;
		height: 80px;
	}

	.shopping_list {
		display: flex;
		justify-content: space-around;
	}

	.shoppine_name {
		font-weight: 900;
	}

	.shoppine_price {
		color: red;
		font-weight: 900;
	}

	.tab {
		display: flex;
		justify-content: space-around;
		color: #808080;
		margin-top: 20px;
	}

	.tab image {
		width: 100%;
		height: 100%;
	}

	.merchant_tab {
		display: flex;
		justify-content: space-around;
		margin-top: 50px;
		font-size: 13px;
		color: #707070;
	}

	.labels {
		color: red;
		border: 1px solid red;
		font-size: 12px;
		border-radius: 15px;
		padding: 2px;
		margin-top: -5px;
	}

	.appraise {
		font-size: 13px;
		background-color: #fff8e1;
		color: #ffc989;
		width: 60%;
		text-align: center;
		margin-top: 8px;
	}

	.shoppine_div {
		width: 70%;
	}

	.meituan {
		width: 50%;
		text-align: center;
		color: #000000;
		background-color: #ffd161;
		font-size: 12px;
		font-weight: 900;
		padding: 1px;
		border-radius: 5px;
	}

	.score {
		font-size: 13px;
		color: #555555;
		width: 40%;
	}

	.merchant_view {
		display: flex;
		justify-content: space-around;
		margin-top: 10px;
	}

	.merchant_name {
		font-weight: 900;
		font-size: 16px;
	}

	.merchant {
		background-color: #FFFFFF;
		width: 95%;
		margin-left: 2.5%;
		height: 130px;
		margin-top: 20px;
		display: flex;
		justify-content: start;
		border-radius: 15px;
	}

	.merchant image {
		width: 100px;
		height: 70px;
	}
</style>
